<template>
  <div>
    <el-input v-model="input" placeholder="请输入病人编号" style="width:400px"></el-input>

    <el-button type="primary" @click="queryByKid(input)">搜索</el-button>
    <el-table :data="tableData" border style="width: 100%">
      <el-table-column prop="rgdate" label="挂号日期" width="180"></el-table-column>
      <el-table-column prop="kname" label="挂号科室" width="180"></el-table-column>
      <el-table-column prop="dname" label="医生姓名"></el-table-column>
    </el-table>
  </div>
</template>


<script>
export default {
  data() {
    return {
      input: '',
      // 将 selectbypid 改为数组
      tableData: []
    };
  },
  methods: {
    // 新增根据 pid 查询的方法
    queryByKid(input) {
      this.$axios
        .get("regin/selectbypid?pid=" + input)
        .then(result => {
          let vo = result.data;
          this.$message = vo.message;
          if (vo.code == 200) {
            this.tableData = vo.data;
          }
        })
        .catch(err => {
          console.log(err);
        });
    }
  }
};
</script>